'\" te
.\" Copyright (C) 1990, Regents of the University of Michigan.  All Rights Reserved.
.\" Portions Copyright (C) 2002, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH LDAP_ADD 3LDAP "Jan 27, 2002"
.SH NAME
ldap_add, ldap_add_s, ldap_add_ext, ldap_add_ext_s \- perform an LDAP add
operation
.SH SYNOPSIS
.LP
.nf
cc[ \fIflag\fR... ] \fIfile\fR... -lldap[ \fIlibrary\fR... ]
#include <lber.h>
#include <ldap.h>

\fBint\fR\fBldap_add\fR(\fBLDAP\fR \fI*ld\fR, \fBchar\fR \fI*dn\fR, \fBLDAPMod\fR \fI*attrs\fR[]);
.fi

.LP
.nf
\fBint\fR\fBldap_add_s\fR(\fBLDAP\fR \fI*ld\fR, \fBchar\fR \fI*dn\fR, \fBLDAPMod\fR \fI*attrs\fR[]);
.fi

.LP
.nf
\fBint\fR \fBldap_add_ext\fR(\fBLDAP\fR \fI*ld\fR, \fBchar\fR \fI*dn\fR, \fBLDAPMod\fR \fI**attrs\fR,
     \fBLDAPControl\fR \fI**serverctrls\fR,\ \fBint\fR \fI* msgidp\fR);
.fi

.LP
.nf
\fBint\fR \fBldap_add_ext_s\fR(\fBLDAP\fR \fI*ld\fR, \fBchar\fR \fI*dn\fR, \fBLDAPMod\fR \fI**attrs\fR,
     \fBLDAPControl\fR \fI**serverctrls\fR, \fBLDAPControl\fR \fI**clientctrls\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBldap_add_s()\fR function is used to perform an LDAP add operation. It
takes \fIdn\fR, the DN of the entry to add, and \fIattrs\fR, a null-terminated
array of the entry's attributes.  The LDAPMod structure is used to represent
attributes, with the \fImod_type\fR and \fImod_values\fR fields being used as
described under \fBldap_modify\fR(3LDAP), and the \fIldap_op\fR field being
used only if you need to specify the  \fBLDAP_MOD_BVALUES\fR option. Otherwise,
it should be set to zero.
.sp
.LP
Note that all entries except that specified by the last component in the given
DN must already exist. \fBldap_add_s()\fR returns an LDAP error code indicating
success or failure of the operation.  See \fBldap_error\fR(3LDAP) for more
details.
.sp
.LP
The \fBldap_add()\fR function works just like \fBldap_add_s()\fR, but it is
asynchronous.  It returns the message id of the request it initiated.  The
result of this operation can be obtained by calling \fBldap_result\fR(3LDAP).
.sp
.LP
The  \fBldap_add_ext()\fR function initiates an asynchronous add operation and
returns  \fBLDAP_SUCCESS\fR if the request was successfully sent to the server,
or else it returns a LDAP error code if not (see  \fBldap_error\fR(3LDAP)). If
successful,  \fBldap_add_ext()\fR \fBplaces\fR \fBthe\fR \fBmessage\fR \fBid\fR
\fBof\fR \fI*msgidp\fR. A subsequent call to  \fBldap_result()\fR, can be used
to obtain the result of the  add request.
.sp
.LP
The  \fBldap_add_ext_s()\fR function initiates a synchronous add operation and
returns the result of the operation itself.
.SH ERRORS
.sp
.LP
\fBldap_add()\fR returns  \fB\(mi1\fR in case of error initiating the request,
and will set the \fIld_errno\fR field in the \fIld\fR parameter to indicate the
error. \fBldap_add_s()\fR will return an LDAP error code directly.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for a description of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
Interface Stability	Evolving
.TE

.SH SEE ALSO
.sp
.LP
.BR ldap (3LDAP),
.BR ldap_error (3LDAP),
.BR ldap_modify (3LDAP),
.BR attributes (7)
